public class MySingleLinkedList implements SingleLinkedList {
	private class Spis{
		String name;
		Spis next;
	}
	private Spis head;
	public boolean isEmpty(){
		if (head==null){
			return true;
		}
		else{
			return false;
		}
	};
	public int size(){
		int i;
		i = 0;
		Spis tmp = head;
		while (tmp.next != null){
			tmp = tmp.next;
			i++;
		}
		return i;
	};
	public void insertFirst(String value){
		if (head==null){
			Spis spis = new Spis();
			spis.name = value;
			spis.next = null;
			head = spis;
		}
		else{
			Spis spis = new Spis();
			spis.name = value;
			spis.next = head;
			head = spis;
		}
	};
	public void insertLast(String value){
		if (head == null){
			Spis spis = new Spis();
			spis.name = value;
			spis.next = null;
			head=spis;
		}
		else{
			Spis tmp = head;
			while(tmp.next != null){
				tmp=tmp.next;
			};
			Spis spis = new Spis();
			spis.name = value;
			spis.next = null;
			tmp.next=spis;
		};
	};
	public void insert(String value, int position){
		int i=0;
		Spis tmp = head;
		Spis spis = new Spis();
		spis.name = value;
		if (position > size()) {
		  throw new RuntimeException("Position="+position+" is out of list bounds");
		}
		while(i != position){
			tmp = tmp.next;
			i++;
		};

		spis.next = tmp.next;
		tmp.next = spis;
	};
	public String get(int position){
		Spis tmp = head;
		int i = 0;
		if (position > size()) {
		  throw new RuntimeException("Position="+position+" is out of list bounds");
		}
		while (i != position){
			tmp = tmp.next;
			i++;
		};
		return tmp.name;
	};
	public void remove(int position){
		Spis tmp = head;
		int i = 1;
		if (position > size()) {
		  throw new RuntimeException("Position="+position+" is out of list bounds");
		}
		while (i != position){
			tmp = tmp.next;
			i++;
		};
		tmp.next = tmp.next.next;
	};
	public void clear(){
		head = null;
	};
	public void swap(int pos1, int pos2){
/*		int i=1;
		if ((pos1 > size()) || (pos2>size()) ) {
		  throw new RuntimeException("Position="+position+" is out of list bounds");
		}
		Spis tmp1 = head;
		while (i != pos1){
			tmp1 = tmp1.next;
			i++;
		};
*/		
	};
}